Skip to content

feat(helper): add Message class to handle message #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 28, 2025
Merged

Conversation

Mister-Hope
Copy link
Member

No description provided.

@coveralls
Copy link

coveralls commented Mar 28, 2025

Pull Request Test Coverage Report for Build 14132289657

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 59.517%

Totals Coverage Status
Change from base Build 14130405017: 0.0%
Covered Lines: 1358
Relevant Lines: 2059

💛 - Coveralls

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

A feature to add a new Message class for handling in-app messages in the client utilities.

  • Introduces a Message class to create, display, and remove messages.
  • Exports the new Message class via the utils index.
  • Updates the ESLint configuration to allow empty private constructors.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
tools/helper/src/client/utils/message.ts Adds the Message class with pop, close, and destroy methods to manage messages.
tools/helper/src/client/utils/index.ts Exports the newly added Message class.
eslint.config.js Adds an ESLint rule to permit empty private constructors.
Files not reviewed (1)
  • tools/helper/src/client/styles/message.scss: Language not supported
Comments suppressed due to low confidence (1)

tools/helper/src/client/utils/message.ts:46

  • [nitpick] Consider adding the option { once: true } to the 'animationend' event listener to ensure the listener is automatically removed after execution.
      messageElement.addEventListener('animationend', () => {


public pop(html: string, duration = 2000): number {
const messageElement = document.createElement('div')
const messageId = Date.now()
Copy link
Preview

Copilot AI Mar 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Date.now() to generate a messageId may lead to collisions if multiple messages are created in rapid succession. Consider using a more robust unique ID generator.

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pengzhanbo I think the AI is right about this, any suggestions with it?

@Mister-Hope Mister-Hope merged commit 48aa1c4 into main Mar 28, 2025
34 checks passed
@Mister-Hope Mister-Hope deleted the message branch March 28, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants